import React, {useCallback} from 'react'
import {connect} from 'react-redux'
import Header from '@/components/Header'
import Nav from '@/components/Nav'
import Bottom from './bottom'
import List from './list'
import './App.css'

function App(props) {
  const {dispatch, from, to} = props
  const onBack = useCallback(() => {
    window.history.back()
  }, [])
  return (
    <div>
      <div className="header-wrapper">
        <Header title={`${from}——${to}`} goBack={onBack} />
      </div>
      <Nav />
      <List />
      <Bottom />
    </div>
  )
}

export default connect(state => state, (dispatch) => ({dispatch}))(App)

